<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>eclipse配置python开发环境</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Zendwind">

    <!-- Le styles -->
    <link rel="stylesheet" href="../../../../theme/css/bootstrap.min.css" type="text/css" />
    <style type="text/css">
      body {
        padding-top: 60px;
        padding-bottom: 40px;
      }
      .sidebar-nav {
        padding: 9px 0;
      }
      .tag-1 {
        font-size: 13pt;
      }
      .tag-2 {
        font-size: 10pt;
      }
      .tag-2 {
        font-size: 8pt;
      }
      .tag-4 {
        font-size: 6pt;
     }
    </style>
    <link href="../../../../theme/css/bootstrap-responsive.min.css" rel="stylesheet">
        <link href="../../../../theme/css/font-awesome.css" rel="stylesheet">

    <link href="../../../../theme/css/pygments.css" rel="stylesheet">

    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!-- Le fav and touch icons -->
    <link rel="shortcut icon" href="../../../../theme/images/favicon.ico">
    <link rel="apple-touch-icon" href="../../../../theme/images/apple-touch-icon.png">
    <link rel="apple-touch-icon" sizes="72x72" href="../../../../theme/images/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="114x114" href="../../../../theme/images/apple-touch-icon-114x114.png">

    <link href="../../../../" type="application/atom+xml" rel="alternate" title="ZendWind ATOM Feed" />
    <link href="../../../../feeds/all.rss.xml" type="application/atom+xml" rel="alternate" title="ZendWind RSS Feed" />

  </head>

  <body>

    <div class="navbar navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container-fluid">
          <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </a>
          <a class="brand" href="../../../../index.html">ZendWind </a>
          <div class="nav-collapse">
            <ul class="nav">
                  <li><a href="http://www.zendwind.com"><font color="#58ACFA">主页</font></a></li>
                  <li><a href="http://www.zendwind.com/category/c.html"><font color="#58ACFA">C/C++</font></a></li>
                  <li><a href="http://www.zendwind.com"><font color="#58ACFA">Linux</font></a></li>
                  <li><a href="http://www.zendwind.com/category/python.html"><font color="#58ACFA">Python</font></a></li>
                  <li><a href="http://www.zendwind.com/feeds/all.atom.xml"><font color="#58ACFA">Feed</font></a></li>
                  <li><a href="http://www.zendwind.com"><font color="#58ACFA">生活杂谈</font></a></li>
                  <li><a href="http://www.zendwind.com/category/about.html"><font color="#58ACFA">About</font></a></li>
                          <li class="divider-vertical"></li>
		    </ul>
            <!--<p class="navbar-text pull-right">Logged in as <a href="#">username</a></p>-->
          </div><!--/.nav-collapse -->
        </div>
      </div>
    </div>

    <div class="container-fluid">
      <div class="row">
        <div class="span9" id="content">
<section id="content">
        <article>
                <header>
                        <h1>
                                <a href=""
                                        rel="bookmark"
                                        title="Permalink to eclipse配置python开发环境">
                                        eclipse配置python开发环境
                                </a>
                        </h1>
                </header>
                <div class="entry-content">
                <div class="well">
<footer class="post-info">
<span class="label">Date</span>
<abbr class="published" title="2014-01-06T00:00:00">
        <i class="icon-calendar"></i>周一 06 一月 2014
</abbr>
<span class="label">By</span>
<a href="../../../../author/zendwind.html"><i class="icon-user"></i>Zendwind</a>
<!--
<span class="label">Category</span>
<a href="../../../../category/python.html"><i class="icon-folder-open"></i>Python</a>.
-->

<span class="label">Tags</span>
	<a href="../../../../tag/eclipse.html"><i class="icon-tag"></i>eclipse</a>
</footer><!-- /.post-info -->                </div>
                <p><strong>摘要</strong>：每天也会上园子瞧瞧，但却好久没动笔了。感慨现在走的路有点偏离原来的预想，以至于无法全身心投入对心向神往的语言作进一步的研究。但仍无法就此放弃，还是希望能延续自己的梦想。今天抽了点时间出来研究了下ubuntu下python IDE环境的配置，希望能给自己一个良好的开始。</p>
<p><strong>目录</strong>：</p>
<ul>
<li><a href="#env_introduction">KDE 环境介绍</a><ul>
<li><a href="#install_env">安装环境</a></li>
<li><a href="#install_step">安装步骤</a><ul>
<li><a href="#install_jre">JRE安装</a></li>
<li><a href="#install_eclipse">Eclipse安装</a></li>
<li><a href="#install_pydev">PyDev安装</a></li>
</ul>
</li>
<li><a href="#install_problem">安装问题</a></li>
</ul>
</li>
</ul>
<h1 id="install_env">安装环境</h1>

<p>目前Linux下用于Pytho开发的IDE环境有很多，像wxPython,ActivePython,Komodo这些NX的环境等。在这里，由于考虑到以后项目的需要，所选IDE环境为Eclipse+PyDev,这个环境不是最好，但用得也是比较广泛的。
<h1 id="install_step">安装步骤</h1>
<h2 id="install_jre">JRE 安装</h2>
Eclipse需要Java运行环境的支撑，一般有JRE和JDK.具体安装哪个根据个人需要。这里主要考虑JRE的安装。Windows下的JRE直接到官网下载后点击安装即可。在Ubuntu下安装文件此处下的是后缀为.bin的文件，版本：<code>sun-java6-jre</code>,文件名：<code>jre-6u27-linux-i586.bin</code>,安装文件很容易下载，版本各取所需，推荐：<code>www.java.com</code>。安装步骤如下：</p>
<p>Step1:创建Java文件夹目录：</p>
<div class="highlight"><pre><span class="n">sudo</span> <span class="n">mkdir</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">java</span>
</pre></div>


<p>Step2:拷贝.bin文件:</p>
<div class="highlight"><pre><span class="n">sudo</span> <span class="n">mv</span> <span class="n">jre</span><span class="o">-</span><span class="mi">6u27</span><span class="o">-</span><span class="n">linux</span><span class="o">-</span><span class="n">i586</span><span class="p">.</span><span class="n">bin</span>  <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">java</span>
</pre></div>


<p>Step3: 更改.bin文件权限：</p>
<div class="highlight"><pre><span class="n">sudo</span> <span class="n">chmod</span> <span class="n">a</span><span class="o">+</span><span class="n">x</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">java</span><span class="o">/</span> <span class="n">jre</span><span class="o">-</span><span class="mi">6u27</span><span class="o">-</span><span class="n">linux</span><span class="o">-</span><span class="n">i586</span><span class="p">.</span><span class="n">bin</span>
</pre></div>


<p>Step4: 执行.bin文件: </p>
<div class="highlight"><pre><span class="n">sudo</span> <span class="p">.</span><span class="o">/</span> <span class="n">jre</span><span class="o">-</span><span class="mi">6u27</span><span class="o">-</span><span class="n">linux</span><span class="o">-</span><span class="n">i586</span><span class="p">.</span><span class="n">bin</span>
<span class="mi">5</span><span class="err">）</span>
</pre></div>


<p>Step5: 安装过程会提示是否继续，按[y]继续。安装成功会显示Done字样表示安装完成。</p>
<p>Step6: 进入/usr/java会发现一个jre的文件夹jre1.6.0_27
Step7: 网上很多资料都会建一个软链接以便以后更新版本。  此处为:</p>
<div class="highlight"><pre><span class="n">ln</span> <span class="err">–</span><span class="n">s</span> <span class="n">jre1</span><span class="mf">.6.0</span><span class="n">_27</span> <span class="n">myjre</span>
</pre></div>


<p>Step8: 建立系统默认启动程序。Linux要识别所安装的java，必须为其配置环境路径。此处为以后方便查询及删除,设置路径为:/usr/local/bin.命令如下：</p>
<div class="highlight"><pre><span class="n">sudo</span> <span class="n">update</span><span class="o">-</span><span class="n">alternatives</span> <span class="o">--</span><span class="n">install</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">local</span><span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="n">java</span>  <span class="n">java</span>  <span class="o">/</span><span class="n">usr</span><span class="o">/</span> <span class="n">java</span><span class="o">/</span><span class="n">myjre</span><span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="n">java</span> <span class="mi">50</span>
<span class="n">sudo</span> <span class="n">update</span><span class="o">-</span><span class="n">alternatives</span> <span class="o">--</span><span class="n">install</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">local</span><span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="n">javaws</span> <span class="n">javaws</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span> <span class="n">java</span><span class="o">/</span><span class="n">myjre</span><span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="n">javaws</span> <span class="mi">50</span>
</pre></div>


<p>Step9: 进入/usr/local/bin可看到两个链接文件。</p>
<h2 id="install_eclipse">Eclipse 安装</h2>

<p>其实Eclipse安装很简单，直接将下载的包解压缩到一个文件夹即可执行。安装文件可去Eclipse的官网下载。此处下载的是3.7版本的，文件名：<code>eclipse-SDK-3.7.1-linux-gtk.tar.gz</code>.安装步骤如下：</p>
<p>Step1：创建Eclipse文件夹:</p>
<div class="highlight"><pre><span class="n">sudo</span> <span class="n">mkdir</span> <span class="o">/</span><span class="n">opt</span><span class="o">/</span><span class="n">eclipse</span>
</pre></div>


<p>Step2：将下载文件拷贝到/opt/eclipse目录下。</p>
<p>Step3：解压缩文件：</p>
<div class="highlight"><pre><span class="n">tar</span> <span class="err">–</span><span class="n">zxvf</span> <span class="n">eclipse</span><span class="o">-</span><span class="n">SDK</span><span class="o">-</span><span class="mf">3.7.1</span><span class="o">-</span><span class="n">linux</span><span class="o">-</span><span class="n">gtk</span><span class="p">.</span><span class="n">tar</span><span class="p">.</span><span class="n">gz</span>
</pre></div>


<p>Step4：在桌面创建Eclipse启动器：右键单击桌面创建启动器，选择命令所在路径:<code>/opt/eclipse/eclipse</code>.这样以后直接双击桌面启动器即可启动Eclipse。
<h2 id="install_pydev">PyDev配置</h2>
PyDev配置比较简单,有两种方案：
<h3><font color=blue>方案1</font><h3>
Step1: 打开Eclipse 中的Help | Software Updates | Find and Install。</p>
<p>Step2: 在Feature Update窗口，选择Search new features to install。</p>
<p>Step3: 在Install窗口，选择:new remote site,填入项：</p>
<div class="highlight"><pre><span class="n">Name</span><span class="err">：</span><span class="n">PyDev</span> 
<span class="n">URL</span><span class="err">：</span> <span class="n">http</span><span class="o">:</span><span class="c1">//pydev.org/updates</span>
</pre></div>


<p>Step4: 在搜寻结果窗口，选择both PyDev Extensions，点击下一步。</p>
<p>Step5: 在Feature License窗口，选择同意协议，点击下一步。</p>
<p>Step6: 配置python 编译器：进入Eclipse中的<code>Window | Preferences | Pydev | Interpreter</code>,，选择python.在<code>python interpreters section</code>中，选择新建一个：在弹出的文件对话框中选择<code>/usr/bin/python2.6</code> 或者 <code>/usr/bin/python</code>.
<h3><font color=blue>方案2</font></h3>
 由于在ubuntu下网络有问题，特从<a href="http://pydev.org/download.html">pydev.org</a>中下载了一个.zip的文件。其实这更简单，直接将压缩文件解压缩至<code>Eclipse/plugins</code>目录下即可，有两个文件夹：分别为：<code>plugins</code> 和<code>features</code>。然后再按方案1 的方法配置python interpreter。
<h2 id="install_problem">安装问题</h2>
<h3><font color=blue>JRE安装问题</font></h3>
    在第一次安装过程中发现Eclipse无法识别，发现是设置默认程序那一步漏了，比较低级。
<h3><font color=blue>PyDev安装问题</font></h3>
      网上介绍的多是第一种配置方案，由于所处网络问题，无法用第一种方案。只能先在windows下先下载pydev压缩文件，将其解压到相应目录。方案2其实是最简单的，却是我所忽略的，以后会多注意尝试用不同方案去解问题。
<h1>小结</h1>
折腾了一个上午，终于把这个环境给搭建起来了，不过暂时还用不上，得自己挤时间来进行该平台的python开发。</p>
<p>PS:写个总结真不简单，崇拜那些天天写BLOG的大牛,鄙视自己一把。</p>
                </div><!-- /.entry-content -->
        </article>
</section>
        </div><!--/span-->
		
        <div class="span3 well sidebar-nav" id="sidebar">
<ul class="nav nav-list">
<li class="nav-header"><h4>分类目录</h4></li>
<hr color=#987cb9 SIZE=3 />
<li>
	<a href="../../../../category/about.html">
		About
	</a>	
</li>
<li>
	<a href="../../../../category/git.html">
		GIT
	</a>	
</li>
<li>
	<a href="../../../../category/python.html">
		Python
	</a>	
</li>

<li class="nav-header"><h4>标签云</h4></li>
<hr color=#987cb9 SIZE=3 />
<a href="../../../../tag/pygame.html">
        pygame&nbsp;&nbsp;
</a>
<a href="../../../../tag/eclipse.html">
        eclipse&nbsp;&nbsp;
</a>
<a href="../../../../tag/pelican.html">
        pelican&nbsp;&nbsp;
</a>
<a href="../../../../tag/django.html">
        Django&nbsp;&nbsp;
</a>
<a href="../../../../tag/push.html">
        push&nbsp;&nbsp;
</a>
<a href="../../../../tag/about.html">
        about&nbsp;&nbsp;
</a>
<a href="../../../../tag/git.html">
        git&nbsp;&nbsp;
</a>
<br />
<br />
<li class="nav-header"><h4>友情链接</h4></li>
<hr color=#987cb9 SIZE=3 />
    <li><a href="http://bbs.chinaunix.net/forum.php?gid=277" target=_blank>ChinaUnix运维专栏</a></li>
    <li><a href="http://bbs.linuxtone.org/forum.php" target=_blank>LinuxTone运维专栏</a></li>
    <li><a href="http://wiki.saltstack.cn/" target=_blank>SaltStack维基-自动化运维</a></li>
    <li><a href="http://www.huxiu.com/" target=_blank>虎嗅网-商业资讯与交流平台</a></li>
    <li><a href="http://www.36kr.com/" target=_blank>36氪-互联网创业</a></li>


</ul>        </div><!--/.well -->
		<!--add by zendwind-->
		<div class="span9" id="content">
			<hr size=2>
<!-- Baidu Button BEGIN -->
<div id="bdshare" class="bdshare_t bds_tools get-codes-bdshare">

<a class="bds_qzone"></a>
<a class="bds_tsina"></a>
<a class="bds_tqq"></a>
<a class="bds_renren"></a>
<a class="bds_t163"></a>
<span class="bds_more"></span>
</div>
<script type="text/javascript" id="bdshare_js" data="type=tools&amp;uid=0" ></script>
<script type="text/javascript" id="bdshell_js"></script>
<script type="text/javascript">
document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + Math.ceil(new Date()/3600000)
</script>
<!-- Baidu Button END -->		</div>
		
		<div class="span9" id="content">
			<hr size=2>

<!-- Duoshuo Comment BEGIN -->
<div class="ds-thread"></div>
<script type="text/javascript">
var duoshuoQuery = {short_name:"zendwind"};
	(function() {
		var ds = document.createElement('script');
		ds.type = 'text/javascript';ds.async = true;
		ds.src = 'http://static.duoshuo.com/embed.js';
		ds.charset = 'UTF-8';
		(document.getElementsByTagName('head')[0] 
		|| document.getElementsByTagName('body')[0]).appendChild(ds);
	})();
	</script>
<!-- Duoshuo Comment END -->		</div>
		 
      </div><!--/row-->
	   
      <hr>

      <footer>
        <address id="about">
        <<center>Power by Pelican, Copyright@ <a href="http://www.zendwind.com">ZendWind</a></center>
        </address><!-- /#about -->
		<p><center> @ZendWind Personal Blog </center></p>
      </footer>

    </div><!--/.fluid-container-->


<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
	var pageTracker = _gat._getTracker("UA-46020847-1");
pageTracker._trackPageview();
} catch(err) {}</script>
	

    <!-- Le javascript -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="../../../../theme/js/jquery-1.7.2.min.js"></script>
    <script src="../../../../theme/js/bootstrap.min.js"></script>
  </body>
</html>